# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-randomly
pkgver=3.15.0
pkgrel=1
pkgdesc='Pytest plugin to randomly order tests and control random.seed'
arch=('any')
license=('MIT')
url='https://github.com/pytest-dev/pytest-randomly'
depends=('python-importlib-metadata' 'python-pytest')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-factory-boy' 'python-faker' 'python-numpy' 'python-pytest-xdist')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pytest-dev/pytest-randomly/archive/$pkgver.tar.gz")
sha512sums=('7ead074f0b2fbd20ab383258808986f3900ab83ef18bc68440ed55eae2ad21912a30b03be830091e86570cba768c1f13b5f15852f5aa0095ffd7e134e55c884f')

build() {
  cd pytest-randomly-$pkgver
  python -m build -nw
}

check() {
  cd pytest-randomly-$pkgver
  python -m installer -d tmp_install dist/*.whl
  # tests/test_pytest_randomly.py::test_model_bakery requires python-model-bakery which is not packaged
  # tests/test_pytest_randomly.py::test_entrypoint_injection: TODO
  PYTHONPATH="$PWD/tmp_install/usr/lib/python3.11/site-packages" \
    pytest --deselect tests/test_pytest_randomly.py::test_model_bakery \
           --deselect tests/test_pytest_randomly.py::test_entrypoint_injection
}

package() {
  cd pytest-randomly-$pkgver
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
